<div>
	<yu-panel title="事件管理" v-loading="exportLoading">
		<yu-row :gutter="24">
			<yu-col :span="5">
				<div class="tree-custom-event">
					<yu-button-group>
						<el-button class="btn" @click="createTreeFn" :disabled="!addClassFnButton">新增</el-button>
						<el-button class="btn" @click="updateTreeFn" :disabled="!updateClassFnButton">修改</el-button>
						<el-button class="btn" @click="deleteTreeFn" :disabled="!deleteClassFnButton">删除</el-button>
					</yu-button-group>
				</div>
				<yu-xtree ref="refTree" :height="height" @node-click="nodeClickFn" :data-url="treeDataUrl" data-id="currentNodeId" data-label="currentNodeName"
				 data-pid="parentId" :data-async="async" data-root="0000" icon="iconPath" style="margin-right: 5px">
				</yu-xtree>
			</yu-col>
			<yu-col :span="19">
				<yu-xform related-table-name="refTable" form-type="search" v-model="searchFormdata">
					<yu-xform-group :column="4">
						<yu-xform-item label="系统名称" placeholder="系统名称" ctype="input" name="appName" :disabled="appNameDisabled"></yu-xform-item>
						<yu-xform-item label="事件代码" placeholder="事件代码" ctype="input" name="eventCode" ></yu-xform-item>
						<yu-xform-item label="事件名称" placeholder="事件名称" ctype="input" name="eventName" :disabled="eventNameDisabled"></yu-xform-item>
						<yu-xform-item label="事件类型" placeholder="事件类型" ctype="select" name="eventType" data-code="USE_EVENT_TYPE"></yu-xform-item>
					</yu-xform-group>
				</yu-xform>
				<yu-toolBar>
					<yu-button @click="addFn" v-if="isNodeLeaf&&addFnButton">新增</yu-button>
					<yu-button @click="modifyFn" v-if="updateFnButton">修改</yu-button>
					<yu-button @click="deleteFn" v-if="deleteFnButton">删除</yu-button>
					<yu-button @click="importFlowFn" v-if="importFnButton">excel导入</yu-button>
					<yu-button @click="exportFlowFn" v-if="exportFnButton">excel导出</yu-button>
				</yu-toolBar>
				<!--<el-table-x ref="refTable" :data-url="dataUrl" :pageable="true" :radiobox="true" :table-columns="tableColumns" @custom-detail-click="viewDataFn">
				</el-table-x>-->
				<div ref="tableBox" style="overflow: auto;">
					<yu-xtable  :height="tbHeight" ref="refTable" row-number :data-url="dataUrl" selection-type="checkbox" :pageable="true">
						<yu-xtable-column label="系统名称"  :show-overflow-tooltip="true" prop="appName"></yu-xtable-column>
						<yu-xtable-column label="事件代码" :show-overflow-tooltip="true" prop="eventCode">
							<template slot-scope="scope">
								<a style="text-decoration:underline;color:#636CE4 " href="javascipt:void(0);" @click="viewDataFn(scope.row)">{{ scope.row.eventCode }}</a>
							</template>
						</yu-xtable-column>
						<yu-xtable-column label="事件名称" :show-overflow-tooltip="true" prop="eventName"></yu-xtable-column>
						<yu-xtable-column label="事件路径" :show-overflow-tooltip="true" prop="folderPath" ></yu-xtable-column>
						<yu-xtable-column label="事件类型" data-code="USE_EVENT_TYPE" prop="eventType"></yu-xtable-column>
					</yu-xtable>
				</div>
				<yu-xdialog :title="viewTitle" :visible.sync="dialogVisible" width="700px">
					<yu-xform ref="refForm" v-model="formdata" label-width="100px" :rules="ruleslist">
						<yu-xform-group>
							<yu-xform-item ctype="input" name="appCode" hidden></yu-xform-item>
							<yu-xform-item ctype="input" name="eventCode" hidden></yu-xform-item>
							<yu-xform-item ctype="input" name="folderCode" hidden></yu-xform-item>
							<yu-xform-item label="事件代码" maxlength="64" ctype="input" name="eventCode" :colspan="12" :disabled="!isAdd">
							</yu-xform-item>
							<yu-xform-item label="事件名称" ctype="input" maxlength="120" name="eventName" :colspan="12" rules="required"></yu-xform-item>
							<yu-xform-item label="所属目录" ctype="input" :colspan="12" name="folderName" rules="required" readOnly icon='search' @click="selectFolder"></yu-xform-item>
							<yu-xform-item label="事件类型" ctype="select" :colspan="12" name="eventType" rules="required" :options="eventTypeOption" @change="changeEventType"></yu-xform-item>
							<yu-xform-item label="代理名称" ctype="select" name="agentCode" :colspan="12" rules="required" :options="agentIds" v-if="isFileEvent"></yu-xform-item>
						</yu-xform-group>
					</yu-xform>
					<el-form ref="serverTabForm" label-width="100px" v-if="isFileEvent">
						<el-form-item label="文件:" require="true">
							<yu-toolBar>
								<el-button-group>
									<el-button @click="addFile">新增</el-button>
									<el-button @click="deleteFile">删除</el-button>
								</el-button-group>
							</yu-toolBar>
							<yu-xtable selection-type="checkbox" ref="refFiletab" :pageable="false" :data="filDatas" style="width: 100%" max-height="150">
								<yu-xtable-column label="文件路径" prop="pathName" maxlength="250"  ctype="yufp-select-params"  :params="paramObj"  @select-fn="getSelectedData">
								</yu-xtable-column>
								<yu-xtable-column prop="remark" ctype="input" label="备注" maxlength="240">
								</yu-xtable-column>
							</yu-xtable>
						</el-form-item>
					</el-form>
					<yu-xform ref="refFormMark" v-model="formdataRemark" label-width="100px">
						<yu-xform-group>
							<yu-xform-item label="备注" ctype="textarea" name="remark" maxlength="240" :colspan="24" :rows="3"></yu-xform-item>
						</yu-xform-group>
					</yu-xform>

					<div class="yu-grpButton">
						<yu-button v-show="cancelBtnShow" @click="cancelFn">取消</yu-button>
						<yu-button v-show="saveBtnShow" type="primary" v-if="!isView" @click="saveFn" :disabled="isView">保存</yu-button>
						<yu-button v-show="saveBtnShow" type="info" v-if="isView" @click="saveFn" :disabled="isView">保存</yu-button>
					</div>
				</yu-xdialog>
				
				<yu-dialog title="excel导入" :visible.sync="upLoadDialogVisible" width="400px" v-loading="excelloading">
					<yu-upload class="upload-demo" ref="my-upload" :action="upLoadUrl" accept=".xls,.xlsx" :before-upload="checkUpload"
						 :multiple="multipleFalg"	:on-success="successUpload" :file-list="appUploadDatas">
						<yu-button size="small" type="primary">点击上传</yu-button>
						<a slot="tip" class="downloadcss" @click="exportDemo">模板下载</a>
						<div slot="tip" class="el-upload__tip">只能上传excel文件，且不超过100M</div>
					</yu-upload>
					<div class="uplaod-errinfo" v-if="errshow">
						<yu-tag type="danger">上传失败，错误信息如下：</yu-tag>
						<div class="uplaod-errlist">
								<yu-table :data="errdata" highlight-current-row style="width:100%" show-header>
									<yu-table-column type="index"  width="50">
										
									</yu-table-column>
									<yu-table-column prop="errMsg" label="错误信息">
										
									</yu-table-column>
								</yu-table>	
						</div>
					</div>
	<!-- 				<div class="uplaod-errinfo">
						<yu-tag type="danger">上传失败，错误信息如下：</yu-tag>
						<yu-tabs type="border-card">
							<yu-tab-pane>
								<span slot="label"><i class="el-icon-date">事件管理</i></span>
								<div class="uplaod-errlist">
									<yu-table :data="errdata" highlight-current-row style="width:100%" show-header>
										<yu-table-column type="index"  width="50">
											
										</yu-table-column>
										<yu-table-column prop="errMsg" label="错误信息">
											
										</yu-table-column>
									</yu-table>
								</div>
							</yu-tab-pane>
							<yu-tab-pane>
								<span slot="label"><i class="el-icon-date">公共参数管理</i></span>
								<div class="uplaod-errlist">
														
								</div>
							</yu-tab-pane>	
						</yu-tabs>
						
					</div> -->
				</yu-dialog>
				
			</yu-col>
		</yu-row>
	</yu-panel>


	<yu-xdialog :title="viewClassTitle" :visible.sync="classDialogVisible" width="700px">
		<el-form-x label-width="110px" ref="refClassForm" :group-fields="classFields" :buttons="classButtons" />
	</yu-xdialog>
	<yu-xdialog title="选择目录" :visible.sync="chooseFolderDialogVisible" width="300px">
		<yu-xtree :show-checkbox="true" ref="refFolderTree" :height="folderHeight" node-key="currentNodeId"  @check-change="folderNodeClickFn" :default-checked-keys="defaultFolderKey"
		 :data-url="treeDataUrl" data-id="currentNodeId" data-label="currentNodeName" data-pid="parentId" :data-async="async" default-expand-all
		 check-strictly :data-root="folderRoot" icon="iconPath">
		</yu-xtree>
		<div class="yu-grpButton">
			<yu-button v-show="saveBtnShow" type="primary" @click="selectFolderSaveFn">确认</yu-button>
			<yu-button v-show="cancelBtnShow" @click="selectFolderCancelFn">取消</yu-button>
		</div>
	</yu-xdialog>

</div>

<style>
	.downloadcss{
		cursor: pointer;
		margin-left:10px;
	}
	.tree-custom-event {
		border: 1px solid #d1dbe5;
		margin-top: 10px;
		margin-right: 5px;
		padding: 0 !important;
	}

	.tree-custom-event .yu-toolBar {
		padding: 0;
	}

	.tree-custom-event .yu-toolBar>h2 {
		margin: 0;
		padding: 0;
		padding-left: 15px;
	}

	.tree-custom-event .el-button-group {
		display: block;
	}

	.tree-custom-event .el-button-group .el-button {
		border-width: 0;
		border-left-width: 1px;
		border-radius: 0;
		width: 33.3333334%;
	}

	.tree-custom-event .el-button-group .el-button:first-child {
		border-left-width: 0;
	}

	.tree-custom-event .el-button-group .el-button:last-child {
		border-right-width: 0;
	}

	.tree-custom-event .el-tree {
		margin-top: 0;
		margin-right: 0;
		border-width: 0;
		border-top-width: 1px;
	}
	.uplaod-errinfo{
		margin-top: 15px;
	}
	.uplaod-errlist{
		margin-top: 10px;
	}
	.uplaod-flex-error{
		color:red;
		font-size: 14px;
		height: 25px;
		line-height: 25px;
		
	}
</style>